package org.fing.edu.uy.esbadp.utils;

import java.security.MessageDigest;

public class StringUtils {

	public static String createChecksum(String content) throws Exception {
		MessageDigest complete = MessageDigest.getInstance("MD5");
		byte[] b = complete.digest(content.getBytes("UTF-8"));
		//convert byte to hex
		StringBuilder result = new StringBuilder();
		for (int i=0; i < b.length; i++) {
			result.append(Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1));
		}
		return result.toString();
	}

}
